// Simcenter STAR-CCM+ macro: cellpower.java
// Written by Simcenter STAR-CCM+ 18.02.008
package macro;

import java.util.*;

import star.common.*;
import star.energy.*;
//给电芯添加热源

public class step4Orginize_cellpower extends StarMacro {

    public void execute() {
        for (int i = 1; i <= 23; i++) {
            execute0(i);
        }
    }

    private void execute0(int i) {

    Simulation simulation_0 = 
      getActiveSimulation();

    Region region_156 =       simulation_0.getRegionManager().getRegion("C.cell "+i);

    region_156.getConditions().get(EnergyUserVolumeSourceOption.class).setSelected(EnergyUserVolumeSourceOption.Type.TOTAL_SOURCE);

    HeatSourceProfile heatSourceProfile_0 =   region_156.getValues().get(HeatSourceProfile.class);

    heatSourceProfile_0.setMethod(FunctionScalarProfileMethod.class);

    UserFieldFunction userFieldFunction_2 =       ((UserFieldFunction) simulation_0.getFieldFunctionManager().getFunction("discharge cellpower A"+i));

    heatSourceProfile_0.getMethod(FunctionScalarProfileMethod.class).setFieldFunction(userFieldFunction_2);
  }
}
